{include file="./header"  title="插件列表" /}
<div class="container-fluid">
<div class="btn-group">
<a href="{:url('addon_add')}" class="btn btn-primary icon-plus">添加</a>
</div><br /><br />
<table width="100%"  class="table table-striped table-hover">
  <tr>
    <td>名称</td>
    <td>描述</td>
    <td>操作</td>
  </tr>
  {foreach name="list" item="val"}
  <tr>
    <td>{$val.name}　版本：{$val.version}
    <br/>版权：{$val.copyright} 目录：{$val.directory}</td>
    <td>{$val.description}</td>
    <td>
    
    
    <a class="btn btn-primary" href="{:url('addon/start/start?id='.$val['id'])}" role="button">{$val['status']>0?"已启用":"已停用"}</a>
    {empty name="settings"}
    <a class="btn btn-primary" href="{:url('addon_setting?id='.$val['id'])}" role="button">设置</a>
    {/empty}
    
    {notempty name="$val.new_version"}
    <a class="btn btn-info" href="{:url('addon/install/update?name='.$val['directory'])}" role="button">升级</a>
    {/notempty}
    <a class="btn btn-danger confirm" data-msg="卸载后该插件的设置将全部丢失！" data-href="{:url('addon/install/uninstall?id='.$val['id'])}" role="button">卸载</a>
    </td>
  </tr>
  
  {/foreach}
  
  {foreach name="list2" item="val"}
  <tr>
    <td>{$val.name|default=''}　版本：{$val.version|default=''}
    <br/>版权：{$val.copyright|default=''} 目录：{$val.directory|default=''}</td>
    <td>{$val.description|default=''}</td>
    <td>
    <a class="btn btn-primary" href="{:url('addon/install/install?name='.$val['dir'])}" role="button">安装</a>
    <a class="btn btn-danger confirm" data-msg="确定要删除吗？该操作将删除插件文件！" data-href="{:url('addon_del?dir='.$val['dir'])}" role="button">删除</a>
    </td>
  </tr>
  
  {/foreach}
  
</table>
</div>

<script>
$(function(){
	$(".confirm").click(function(e) {
		var msg = $(this).attr('data-msg');
		var url = $(this).attr('data-href');
        if(confirm(msg)){
			window.location.href=url;
		}
    });
	
});
</script>

{include file="./footer" /}
